package com.xgc.rtspconverterflvspringbootstarter.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

/**
 * 使用多线程执行定时任务
 * 
 * @author gc.x
 *
 */
@Configuration
@EnableScheduling
public class SchedulerConfig {
	@Bean
	public TaskScheduler taskScheduler() {
		ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
		// 线程池大小
		scheduler.setPoolSize(3);
		// 线程名字前缀
		scheduler.setThreadNamePrefix("task-thread-");
		return scheduler;
	}

}
